import 'package:fish_redux/fish_redux.dart';
import 'package:package_info/package_info.dart';

import 'action.dart';
import 'state.dart';

Effect<DemandState> buildEffect() {
  return combineEffects(<Object, Effect<DemandState>>{
    Lifecycle.initState: _onVersion,
  });
}

void _onVersion(Action action, Context<DemandState> ctx) async {
  PackageInfo packageInfo = await PackageInfo.fromPlatform();
  print(packageInfo);
  ctx.dispatch(DemandActionCreator.version(packageInfo.version));
}
